package linkedList;

public class CircleListNode {
    int val;
    CircleListNode next;
    CircleListNode first;
    public CircleListNode(int val) {
        this.val = val;
    }
    public void addNode(CircleListNode newNode) {
        if (first == null) {
            first = newNode;
            first.next = newNode;
        }

        CircleListNode cur = first;
        while(cur.next != first){
            cur = cur.next;
        }
        cur.next = newNode;
        newNode.next = first;


    }
}
